package bitoperations;
//不用乘号的乘法
public class Multi {
    public static void main(String[] args) {
        System.out.println(multi(3, 4));
    }

    public static int multi(int a, int b) {
        int res = 0;
        while (b != 0) {
            if((b & 1) != 0){
                res += a;
            }
            b >>= 1;
            a <<= 1;
        }
        return res;
    }
}
